﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;

namespace StudentManagerPro
{
    /// <summary>
    /// DownLoadFile 的摘要说明
    /// </summary>
    public class DownLoadFile : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "image/JPG/text";

            string filaname = context.Request.Params["filaName"].ToString();
            //防止乱码
            string fliename1 = HttpUtility.UrlEncode(filaname+".jpg", Encoding.UTF8);
            context.Response.AddHeader("Content-Disposition", "attachment;filename=" + fliename1);

            context.Response.WriteFile("~/Images/Student/"+ fliename1);
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}